//
//  UIButton+Extension.swift
//  Weibo
//
//  Created by 米易雅克 on 16/4/19.
//  Copyright © 2016年 米易雅克. All rights reserved.
//

import UIKit

extension UIButton {

    convenience init(image: String, bgImage: String = "timeline_card_bottom_background", title: String, fontSize: CGFloat = 12) {
    
        self.init(frame: CGRectZero)
        //按钮创建设置背景图片
        setBackgroundImage(UIImage.init(named: bgImage), forState: UIControlState.Normal)
        setBackgroundImage(UIImage.init(named: "\(bgImage)_highlighted"), forState: UIControlState.Highlighted)
        
        //设置按钮图片
        setImage(UIImage.init(named: image), forState: UIControlState.Normal)
        
        //设置按钮标题
        setTitle(title, forState: UIControlState.Normal)
        
        //设置文字大小颜色
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
    

    }


}
